package com.qinker.oa.provider;

public class CustomerProvider {

    public String findCustomerByNameAndPhone(String customerNumber, String customerName){
        StringBuffer sql = new StringBuffer("select ac.id,customer_name as customerName,customer_number as customerNumber, " +
                "customer_area as customerArea,customer_wechat as customerWechat,customer_contact as customerContact,create_time " +
                "as createTime, budget, customer_level as customerLevel, customer_source as customerSource," +
                "ut.nickname from area_customer as ac inner join user_t as ut on ac.u_id = ut. where 1=1 ");
        if (customerNumber != null && !customerNumber.equals("")){
            sql.append("and customer_number like %"+customerNumber+"% ");
        }
        if (customerName != null && !customerName.equals("")){
            sql.append("and customer_name like %"+customerName+"%");
        }

        sql.append(" order by create_time DESC");
        return sql.toString();
    }
}
